package com.example.service;

import com.example.dao.UserRepository;
import com.example.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author kangshuai
 */
@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserRepository userRepository;

    @Override
    public List<User> findByUser(User user) {
        Example<User> userExample = Example.of(user);
        return userRepository.findAll(userExample);
    }

    @Override
    public void save(User user) {
        userRepository.save(user);
    }
}
